﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using zsi.Framework.Data.DataProvider.SQLServer;
using zsi.Framework.Data;
using zsi.phgov.Models;
using System.Data;
using System.Data.SqlClient;
using zsi.phgov.Util;
namespace zsi.phgov.Models.DataControllers
{
    public class dcRole : MasterDataController<Role>
    {
        public override void InitDataController()
        {
            this.DBConn = new SqlConnection(DBConnection.ConnectionString);
            this.Procedures.Add(new Procedure("dbo.SelectRoles", SQLCommandType.GetSingleInfo));
            this.Procedures.Add(new Procedure("dbo.SelectRoles", SQLCommandType.Select));
            this.Procedures.Add(new Procedure("dbo.UpdateRoles", SQLCommandType.Update));
        }

    
        public List<Role> GetRoleList()
        {            
            this.SelectParameters.Add("p_IsDDL", 1);
            return new dcRole().GetDataSource();
        }

       public Role GetRoleInfo(Object RoleId)
        {
            try
            {
                int _RoleId = Convert.ToInt32(RoleId);
                this.SelectInfoParameters.Add("p_RoleId", _RoleId);
                return this.GetInfo();
            }
            catch (Exception ex) {
                throw ex;
            }
        }

  
    }
}
